Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add flag to ignore problematic file extensions #643

Closed
wants to merge 1 commit into from

Conversation

egibs
Copy link
Member

@egibs egibs commented Nov 18, 2024

Relates to: #587

We're failing to scan certain files that are essentially one long string. Scanning these files with our compiled ruleset seems to be too much for the Yara library and results in this error:

💣 process: report error: scan: too many regular expression fibers

This PR adds a new flag to ignore certain file extensions that cause this error to work around this for the time being.

Example:

$ go run cmd/mal/mal.go --verbose --ignore-exts=.map analyze ~/Downloads/prism/usr/src/prism/node_modules/micri/dist/index.js.map
🔎 Scanning ".../Downloads/prism/usr/src/prism/node_modules/micri/dist/index.js.map"
time=2024-11-18T17:29:18.025-06:00 level=INFO source=.../repos/chainguard-dev/malcontent/pkg/action/scan.go:105 msg="skipping .../Downloads/prism/usr/src/prism/node_modules/micri/dist/index.js.map [.map]: ignored file extension" path.../Downloads/prism/usr/src/prism/node_modules/micri/dist/index.js.map

We'll continue looking into handling files like this in a more resilient way.

@egibs
Copy link
Member Author

egibs commented Nov 18, 2024

This might not be needed. I was able to locate the problematic string/rule.

@tstromberg
Copy link
Collaborator

If we can change this flag to a regular expression or set of globs and add a test, I would love this feature.

@egibs egibs closed this Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants